"""
Perl rules
"""

module(
    name = "rules_perl",
    version = "0.4.2",
)

bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_cc", version = "0.0.17")
bazel_dep(name = "rules_shell", version = "0.4.0")

repos = use_extension("@rules_perl//perl:extensions.bzl", "perl_repositories")
use_repo(
    repos,
    "perl_darwin_amd64",
    "perl_darwin_arm64",
    "perl_linux_amd64",
    "perl_linux_arm64",
    "perl_windows_x86_64",
)

register_toolchains(
    "@rules_perl//perl:perl_darwin_arm64_toolchain",
    "@rules_perl//perl:perl_darwin_amd64_toolchain",
    "@rules_perl//perl:perl_linux_amd64_toolchain",
    "@rules_perl//perl:perl_linux_arm64_toolchain",
    "@rules_perl//perl:perl_windows_x86_64_toolchain",
)

cpan = use_extension("@rules_perl//perl/cpan:extensions.bzl", "cpan")
cpan.install(
    name = "cpan_compiler_deps",
    lock = "//perl/cpan/3rdparty:cpanfile.snapshot.lock.json",
)
use_repo(
    cpan,
    "cpan_compiler_deps",
)

dev_repos = use_extension("@rules_perl//perl:extensions.bzl", "perl_dev_repositories", dev_dependency = True)
use_repo(
    dev_repos,
    "fcgi",
    "genhtml",
)
